import { defineConfig, loadEnv } from 'vite'
import vue from '@vitejs/plugin-vue'
import WindiCSS from 'vite-plugin-windicss'

import path from 'path'

// https://vitejs.dev/config/
export default defineConfig({
  base: '/shopadmin/',
  resolve:{
    alias:{
      "~":path.resolve(__dirname, "src")
    }
  },

  server: {
    open: true,// 项目启动后自动打开浏览器
    port: 7776,// 项目运行的端口
    proxy: {
      '/api': {
        target: 'https://www.xdfznh.club/atoolsbe',
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/api/,'')
      },
      '/shunjiebe':{
        target: 'https://www.barrel.fit/shunjiebe',
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/shunjiebe/,'')
      }
    }
  },

  plugins: [
    vue(),
    WindiCSS()
  ]
})
